﻿<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>登录 DEMO</title>
    <meta charset="UTF-8" />
    <!-- 引用通用的js文件. -->
    <script src="../WF/Scripts/jquery/jquery.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="../WF/Scripts/jquery/jquery.cookie.js"></script>
    <link href="../WF/Style/skin/css/login.css" rel="stylesheet" type="text/css" />
    <link href="../WF/Scripts/bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css" />
    <script src="../WF/Scripts/QueryString.js"></script>

    <!-- 引入配置文件. -->
    <script src="../AppConfig.js"></script>
    <style>
        * {
            margin: 0px;
            padding: 0px;
        }
    </style>
    <script type="text/javascript" language="javascript">
        $(function () {
            $.cookie("UserNo", "");
            $.cookie("SID", "");
            clearAllCookie();
        });
        function clearAllCookie() {
            var myDate = new Date();
            myDate.setTime(-1000);//设置时间    
            var data = document.cookie;
            var dataArray = data.split("; ");
            for (var i = 0; i < dataArray.length; i++) {
                var varName = dataArray[i].split("=");
                document.cookie = varName[0] + "=''; expires=" + myDate.toGMTString();
            }
        }

        //页面启动函数.
        function Login() {
            var userNo = $("#TB_No").val();
            var userPass = $("#TB_PW").val();

            if (userNo == "" || userPass == "") {
                alert('请输入用户名与密码');
                return false;
            }

            $.ajax({
                type: "GET",
                url: handler + "?DoWhat=Portal_Login_Submit", //handler 变量位于 AppConfig.js中定义.
                data: { No: $("#TB_No").val(), Pass: $("#TB_PW").val() },
                dataType: "text",
                async: true,
                success: function (data) {

                    if (data.indexOf('err@') == 0) {
                        alert(data);
                        return;
                    }

                    var userNo = $("#TB_No").val();

                    //把SID写入到cookie.
                    $.cookie("MyUserNo", userNo, { expires: 7, path: '/' });
                    $.cookie("MySID", data, { expires: 7, path: '/' });

                    var userNo = $.cookie("MyUserNo");

                    //因为后台返回了SID. 我们建议每个页面上都使用明文的SID，
                    //不然用户每次都需要调用请求获取sid.
                    location.href = 'Home.htm?SID=' + data;

                }, error: function (e) {

                    alert('登录出现错误status:' + e.status);
                    return;
                    //window.alert(e.status );
                }
            });
            return;
        }
    </script>
</head>
<body style="background-image:url(Img/login_bg.png )">

    <br />
    <br />
    <br />

    <center>
        <form id="Form1">

            <fieldset>
                <legend>CRM子系统-驰骋BPM登录-服务调用集成模式- 演示DEMO </legend>
                <div style="width:20%">
                    <div class="form-group">
                        <input type="text" id="TB_No" name="TB_No" placeholder="请输入账号" lay-verify="required"
                               class="form-control" />
                    </div>
                    <div class="form-group">
                        <input type="password" id="TB_PW" name="TB_PW" placeholder="默认密码为空." lay-verify="required"
                               class="form-control" />
                    </div>
                </div>
                <div style="width:10%">
                    <input type="button" onclick="Login();" class="btn btn-primary btn-block" value="操作员登录-演示" />
                </div>

                <legend style="text-align:left;">说明</legend>
                <ul style="text-align:left; padding-left:50px;">
                    <li>测试人员: admin, zhoutianjiao, zhoushengyu, yangyilei </li>
                    <li>登录后需要写入Port_Emp表的列SID里一个随机的guid作为token，来方位ccbpm的服务. </li>
                    <li>在根目录下 config.js 里，您需要配置提供服务的ccbpm服务器地址。</li>
                </ul>

                <legend style="text-align:left;">资源信息</legend>
                <ul style="text-align:left;padding-left:50px;">
                    <li>驰骋BPM服务地址 <a href="http://140.143.236.168:8078/WF/Admin/Portal/Login.htm" target="_blank">：http://140.143.236.168:8078/WF/Admin/Portal/Login.htm </a> </li>
                    <li>驰骋BPM数据库SQLServer：IP: 140.143.236.168 用户名：ccbpmdemo 密码：123 数据库:DevelopCCBPMServicesDemo </li>
                    <li>项目演示数据库：IP: 140.143.236.168 用户名：ccbpmdemo 密码：123 数据库:DevelopERPDemo </li>
                </ul>

            </fieldset>
        </form>

    </center>
</body>
</html>
